#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>

#define N_MAX 101
#define LEN_MAX 301
#define MIN(a, b) ( (a < b) ? a : b )

char
my_tolower (char ch)
{
	if (ch >= 'A' && ch <= 'Z')	
		return ch - 'A' + 'a';
	else
		return ch;
}


int
my_strtolower (char* first)
{
	int i;
	for (i = strlen(first); i >= 0; --i) {
		first[i] = tolower(first[i]);
	}
	return 0;
}


void
my_strswap (char* one, char* two)
{
	char tmp[LEN_MAX];
	strcpy(tmp, one);

	memset(one, 0, sizeof(tmp));
	strcpy(one, two);

	memset(two, 0, sizeof(tmp));
	strcpy(two, tmp);
}


/*int
my_smart_strcmp (const char *one, const char *two)
{
	long diff=0;
	int i = 0;
	do {
		if (tolower(one[i]) <= tolower(two[i])) { // 'A' <= 'a' ; 'a' <= 'a' ; 'a' <= 'b' ; 'A' <= 'B' ; 'A' <= 'b'.
			if (tolower(one[i]) == tolower(one[i])) { // 'X' == 'x'.
				if (one[i] < two[i]) // 'X' < 'x'.
					diff -= 1;
				else
					diff += 1;
			} else { // 'A' ? 'b' ; 'a' ? 'b' ; 'a' ? 'c'. //letters are different, one[i] < two[i].
				if (one[i] <= 'Z' && one[i] >= 'A') {
					// BREAK!!
		} else { // 'a' > 'A' ; 'c' > 'b' ; 'b' > 'A'
			if (one[i] < two[i]) {
	} while (one[i] != NULL);
}*/

//TROLOLO
/*void
my_smart_sort (char **a, int n, int pos) // n - elements count, pos - theposition we're sorting by
{					 // ascending
	int k1 = 0, k2 = 0, k3 = 0;
	short t = 0;

	while (k1 < n - 1 && tolower(a[k1][pos]) == tolower(a[k1+1][pos]) ) {
		k2 = k1 + 1;
		while (k2 < n && tolower(a[k1][pos]) == tolower(a[k2][pos]) ) {
			if (a[k1][pos] > a[k2][pos])
				my_strswap(a[k1], a[k2]);
			++k2;
		}
		++k1;
	}
}*/


int
my_get_something (char in) /* returns code of letter wrt to our alphabet */
{
	if (in >= 'A' && in <= 'Z')
		return (in - 'A') * 2 + 1;
	else if (in >= 'a' && in <= 'z')
		return (in - 'a') * 2 + 2;
	return 0;
}


int
main (void)
{
	int n;
	int i = 1, k = 0;
	int s_first = 0, s_current = 0;
	char first[LEN_MAX];
	char current[LEN_MAX];
	freopen("minword.in", "r", stdin);
	freopen("minword.out", "w", stdout);

	scanf("%d", &n);
	scanf("%s\n", first);
	while (i < n) {
		scanf("%s", current);
		k = 0;
		s_first = strlen(first);
		s_current = strlen(current);
		while ( k <= MIN(s_first, s_current) ) {
			if ( my_get_something(first[k]) == my_get_something(current[k]) )
				++k; // strings are same so far, go ahead.
			else if (my_get_something(first[k]) > my_get_something(current[k]) || current[k] == 0) {
				strcpy(first, current);
				break; // we don't need this anymore
			} else
				break; // ^^ see above
		}
		++i;
	}
	printf("%s\n", first);
	return 0;
}
